package com;

import java.util.Scanner;

/**
 * @description:
 * @author: Peng Jiwei
 * @create :2021/9/26-11:14
 */
public class Test {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String str = input.nextLine();
        String arr[] = str.split(",");
        int [] arr1  = new int[arr.length];
        for (int i = 0; i < arr.length; i++) {
            arr1[i] = Integer.parseInt(arr[i]);
        }
        int sum = arr1.length;
        for (int j = 0; j < arr1.length; j++) {
            if(j == 0){
                if(arr1[j]>arr1[j+1]){
                    sum++;
                }
            }
            else if(j == arr1.length-1){
                if(arr1[j]>arr1[j-1]){
                    sum++;
                }
            }
            else {
                if(arr1[j]>arr1[j-1] || arr1[j]>arr1[j+1]){
                    sum++;
                }
            }
        }
        System.out.println(sum);
    }
}
